<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      body {
        height: 2000px;
      }
      .father {
        width: 500px;
        height: 300px;
        position: relative;
        left: 100px;
        top: 200px;
        background-color: pink;
        overflow: auto;
        border: 10px solid #000;
        /* padding: 10px 0 0 0; */
      }
      .son2,
      .son1 {
        position: absolute;
        width: 50px;
        height: 50px;
        background-color: greenyellow;
      }
      .son1 {
        height: 500px;
        top: 100px;
        left: 100px;
      }
      .son2 {
        right: 50px;
        bottom: 50px;
        background-color: skyblue;
      }
    </style>
  </head>
  <body>
    <div class="father">
      father
      <div class="son1">son1</div>
      <div class="son2">son2</div>
    </div>
  </body>

  <script>
    // 获取屏幕尺寸
    let screen = window.screen;
    console.log("screen", window);
    console.clear();
    let father = document.querySelector(".father");
    window.father = father;
    let style = window.getComputedStyle(father);
    console.log("father.getComputedStyle", [father]);
  </script>
</html>
